﻿<phone:PhoneApplicationPage
    x:Class="wp8nop.ProdottiList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    shell:SystemTray.IsVisible="True"
    toolkit:TiltEffect.IsTiltEnabled="True"
    DataContext="{Binding ProdottiList, Source={StaticResource Locator}}" Background="White">
    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="VetrinaDataTemplate">
            <Grid Width="450"  Margin="8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="190"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image Height="190" Width="190" Source="{Binding Model.imgs.thumb}"/>
                <Grid Grid.Column="1" Margin="5,0,0,0" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="56"/>
                        <RowDefinition Height="57*"/>
                        <RowDefinition Height="38*"/>
                        <RowDefinition Height="39*"/>
                    </Grid.RowDefinitions>
                    <TextBlock TextWrapping="Wrap" FontWeight="Bold" Text="{Binding Model.name}" FontSize="20" Foreground="Black"/>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap" Text="{Binding Model.desc.breve}" FontSize="20" Foreground="Black"/>
                    <TextBlock FontWeight="Bold" Grid.Row="2" Text="{Binding Price}" FontSize="20" Foreground="Black" />
                    <StackPanel Grid.Row="3" Orientation="Horizontal">
                        <Image  Source="/Assets/Sped.png" Visibility="{Binding IsSpedizioneGratis}"></Image>
                        <TextBlock Text="{Binding PrezzoSpedizione}" FontSize="20" Foreground="#FFED3DF5" Margin="5,0,0,0"/>
                    </StackPanel>
                </Grid>
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>
    <phone:PhoneApplicationPage.Foreground>
        <SolidColorBrush Color="Black"/>
    </phone:PhoneApplicationPage.Foreground>

    <!--LayoutRoot è la griglia radice in cui viene inserito tutto il contenuto della pagina-->
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contiene il nome dell'applicazione e il titolo della pagina-->
        <Grid Height="55" Margin="0" VerticalAlignment="Top" Background="#FFE3AACC"/>

        <!--TitlePanel contiene il nome dell'applicazione e il titolo della pagina-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="24CARATI.COM" Style="{StaticResource PhoneTextNormalStyle}" Foreground="Black"/>
            <TextBlock Text="prodotti" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" Foreground="Black"/>
        </StackPanel>

        <!--ContentPanel - inserire ulteriore contenuto qui-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <ProgressBar
            VerticalAlignment="Top"
            Background="{x:Null}"
            Margin="0,-15,0,0"
            Foreground="Red"
            IsIndeterminate="{Binding IsLoading}"/>
            
            <ListBox Margin="0,0,0,0" Name="lbProducts" SelectedItem="{Binding SelectedProduct, Mode=TwoWay}" ItemTemplate="{StaticResource VetrinaDataTemplate}" ItemsSource="{Binding Prodotti}" />
                
            <ProgressBar
            VerticalAlignment="Bottom"
            Background="{x:Null}"
            Margin="0,0,0,0"
            Foreground="Red"
            IsIndeterminate="{Binding IsLoading}"/>
            <Grid Background="#7F000000" Visibility="{Binding VisibilityLoading}" VerticalAlignment="Bottom" Margin="-13,0" Height="55">

                <TextBlock Text="Caricamento prodotti in corso" VerticalAlignment="Bottom" TextAlignment="Center" Height="45" FontSize="24"/>

            </Grid>

        </Grid>
    </Grid>

</phone:PhoneApplicationPage>